<?php include "../public/header.php"?>
<?php include "../public/header_public.php"?>
<link rel="stylesheet" type="text/css" href="/static/component/laytp/module/cityPicker/city-picker.css">
<body class="laytp-container">
<div style="height: 45px"></div>
<div id="opt_nav">
</div>
<div id="dialog">
    <div class="page-title" id="page-title">
        <div class="page-title-con">
            <span class="title">选择投标项目-投标单位信息</span>
            <div class="move_title"></div>
            <div class="page-title-opt-list">
                <button class="layui-btn layui-btn-sm btn-dark marginr5" type="button" id="submit">确定</button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <div class="layui-col-md12" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    // 单选多选分类 默认单选 choose_type传值为多选
    var choose_type = getQueryVariable('choose_type');
    if(choose_type === undefined || choose_type === false){
        choose_type = 'radio';
    }else{
        choose_type = 'checkbox';
    }

    // 用证使用
    var apply_type = getQueryVariable('apply_type');
    if(apply_type === undefined || apply_type === false){
        apply_type = '';
    }

    var parent_dom = getQueryVariable('dom');
    var parent_bidid = getQueryVariable('bidid') || 0;
    var parent_page = getQueryVariable('page');


    var currButAuth, currTabData, sea_type='', sea_bidding_type='',sea_qualification='',sea_sign_type='',sea_bid_type='',
        sea_bid_evaluation='', queryStatus = 0;
    layui.use(['table','form','soulTable'], function () {
        var table = layui.table, form = layui.form, soulTable = layui.soulTable;


        $('#TableSearchReset').click(function () {
            sea_type=''; sea_bidding_type='';sea_qualification='';sea_sign_type='';sea_bid_type='';sea_bid_evaluation='';
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        $("#cols_table").hide();
        $("#export_table").hide();
        setSouTableExport('投标');
        table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_opt_get_bid_tou),where: {bidid:parent_bidid}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: TabInit.defaultToolbar,filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response
            ,contextmenu:get_table_contextmenu(soulTable)
            ,parseData: function (res) {
                currButAuth = res.data.butauth;
                tableButShow(currButAuth);

                render_from();
                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            ,cols: [[
                {type: choose_type, fixed: 'left'}
                ,{type: 'numbers',title:'序号',fixed:'left'}
                ,{field: 'touunit', title: '投标单位'}
                ,{field: 'touxing_name', title: '性质'}
                // ,{field: 'biaofee', title: '标书费用(元)'}
                // ,{field: 'kaishuo', title: '开标说明'}
                // ,{field: 'kaiguo', title: '开标结果'}
                ,{field: 'explain', title: '备注'}
            ]]
            , done: function (res) {
                soulTable.render(this);
                show_tab_but(currTabData);
            }
        });
        listTableSearch(form, table);

        $('#submit').on('click', function () {
            var checkStatus = layui.table.checkStatus('datalist');
            var data = checkStatus.data;
            if(data.length < 1){
                facade.error("请选择数据");return false;
            }

            if(parent_page === 'bid_shou'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" value="'+data[key].touunit+'" readonly class="layui-input touunit disabled"></td>';
                    str += '<td><div class="feitype feitype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('feitype'+nums, parent.pub_feitype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
                parent.render_from();
            } else if(parent_page === 'bid_zhi'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" value="'+data[key].touunit+'" readonly class="layui-input touunit disabled"></td>';
                    str += '<td><div class="feitype feitype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><select class="layui-select isdian">';
                    str += '<option value="否">否</option>';
                    str += '<option value="个人垫付">个人垫付</option>';
                    str += '<option value="公司垫付">公司垫付</option>';
                    str += '</select></td>';
                    str += '<td><div class="tanxian" style="border: 0;">';
                    str += '<div class="tanxianclick" onclick="choose_userid(this,\'dianer\')"></div>';
                    str += '<div class="tanxiannei dianer"></div></div></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input duier"></td>';
                    str += '<td><input type="text" class="layui-input banknum"></td>';
                    str += '<td><input type="text" class="layui-input bankname"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('feitype'+nums, parent.pub_feitype, '');
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
                parent.render_from();
            } else if(parent_page === 'bid_jiao'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" value="'+data[key].touunit+'" readonly class="layui-input touunit disabled"></td>';
                    str += '<td><input type="text" class="layui-input disabled" readonly value="投标保证金"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><input type="number" class="layui-input shoufee"></td>';
                    str += '<td><select class="layui-select isdian">';
                    str += '<option value="">请选择</option>';
                    str += '<option value="是">是</option>';
                    str += '<option value="否">否</option>';
                    str += '</select></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input duier"></td>';
                    str += '<td><input type="text" class="layui-input banknum"></td>';
                    str += '<td><input type="text" class="layui-input bankname"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
                parent.render_from();
            }else if(parent_page === 'book_shou'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" value="'+data[key].touunit+'" key="'+data[key].id+'" readonly class="layui-input touunit disabled"></td>';
                    str += '<td><input type="text" value="标书代写费" readonly class="layui-input disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].touxing_name+'" readonly class="layui-input disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].biaofee+'" readonly class="layui-input disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].yishoufee+'" readonly class="layui-input disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].daishoufee+'" readonly class="layui-input disabled"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
                parent.render_from();
            }else if(parent_page === 'bid_qu'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" value="'+data[key].touunit+'" readonly class="layui-input touunit disabled"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
                parent.render_from();
            } else {
                var str = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+data[0].id+'"><span class="choose_content">'+data[0].name+'' +
                    '</span><span class="choose_close" onclick="choose_close(this, \''+parent_dom+'\')">×</span></button>';
                $("#"+parent_dom , parent.document).html(str);
                parent.formValid(parent_dom);

            }
            layer_close();
        });
    });
</script>
</body>
</html>
